package com.supercwn.player;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;

import com.supercwn.player.bean.VideoBean;
import com.supercwn.player.utils.Constans;
import com.supercwn.player.utils.JumpToPlay;

/**
 * 类描述：首页
 *
 */
public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.tv_demand_play).setOnClickListener(this);//点播
        findViewById(R.id.tv_live_play).setOnClickListener(this);//直播
        findViewById(R.id.tv_recycleview_player).setOnClickListener(this);//recycleView
        findViewById(R.id.locationMedia).setOnClickListener(this);
        findViewById(R.id.downLoad).setOnClickListener(this);
        WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    }

    @Override
    public void onClick(View view) {
        //视频点播
        if (view.getId() == R.id.tv_demand_play) {
            VideoBean bean = new VideoBean();
            bean.setOnlineUrl("http://flv2.bn.netease.com/videolib3/1611/28/GbgsL3639/SD/movie_index.m3u8");
            bean.setTitle("在线直播视频哈哈哈");
            bean.setLocation(false);
            JumpToPlay.videoPlay(this, bean);
        } else if (view.getId() == R.id.locationMedia) {
            //本地视频播放
            Intent locationIntent = new Intent(this, GetLocationMediaActivity.class);
            startActivity(locationIntent);
        } else if (view.getId() == R.id.downLoad) {
            Intent locationIntent = new Intent(this, DownLoadActivity.class);
            startActivity(locationIntent);
        }
//        //视频直播
//        else if (view.getId() == R.id.tv_live_play) {
//            Intent liveIntent = new Intent(this, SuperVideoDetailsActivity.class);
//            liveIntent.putExtra("isLive", true);
//            liveIntent.putExtra("url", "rtmp://live.hkstv.hk.lxdns.com/live/hks");
//            startActivity(liveIntent);
//            //列表播放
//        } else if (view.getId() == R.id.tv_recycleview_player) {
//            Intent listViewIntent = new Intent(this, SuperVideoRecycleViewActivity.class);
//            startActivity(listViewIntent);
//        }

    }
}
